package com.server.common.logistics.base;

import com.server.common.code.error.BusinessException;
import com.server.common.logistics.enums.ApiEnum;
import com.server.common.logistics.enums.LogisticsCompanyEnum;
import com.server.common.logistics.interfaces.LogisticsFactoryInterface;
import com.server.common.logistics.interfaces.LogisticsService;
import com.server.common.logistics.request.LogisticsRequest;
import com.server.common.logistics.response.LogisticsResponse;
import com.server.common.logistics.result.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@Component
public abstract class BaseLogisticsService implements LogisticsService {

    /**
     * 设置物流公司
     * @author LXC
     * @date 2023/2/26 19:27
     */
    public abstract LogisticsCompanyEnum getLogisticsCompanyEnum();


    @Resource
    private LogisticsFactoryInterface logisticsFactoryInterface;

    //启动时加入到工程中
    @PostConstruct
    public void init() {
        logisticsFactoryInterface.register(getLogisticsCompanyEnum(),this);
    }

    @Override
    public  <T> LogisticsResponse baseRequest(ApiEnum apiEnum, Object params){
        throw new BusinessException("该物流暂无此业务");
    }

    @Override
    public CreateOrderResult createOrder(LogisticsRequest orderRequest) {
        throw new BusinessException("该物流暂无此业务");
    }

    @Override
    public GetOrderResult getOrder(LogisticsRequest orderRequest) {
        throw new BusinessException("该物流暂无此业务");
    }

    @Override
    public void cancelOrder() {
        throw new BusinessException("该物流暂无此业务");
    }

    @Override
    public HoldOrderResult holdOrder(LogisticsRequest holdOrderRequest) {
        throw new BusinessException("该物流暂无此业务");
    }

    @Override
    public GetTrackResult getTracking(LogisticsRequest getTrackRequest) {
        throw new BusinessException("该物流暂无此业务");
    }

    @Override
    public PrintLabelSyncResult printLabelSync(LogisticsRequest printLabelSyncRequest) {
        throw new BusinessException("该物流暂无此业务");
    }


}
